/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.biovida.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author moniqueluiza
 */
@Entity
@Table(name = "empresa", catalog = "biovida", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empresa.findAll", query = "SELECT e FROM Empresa e"),
    @NamedQuery(name = "Empresa.findByIdempresa", query = "SELECT e FROM Empresa e WHERE e.idempresa = :idempresa"),
    @NamedQuery(name = "Empresa.findByRazaoSocial", query = "SELECT e FROM Empresa e WHERE e.razaoSocial = :razaoSocial"),
    @NamedQuery(name = "Empresa.findByCnpj", query = "SELECT e FROM Empresa e WHERE e.cnpj = :cnpj"),
    @NamedQuery(name = "Empresa.findByRamo", query = "SELECT e FROM Empresa e WHERE e.ramo = :ramo"),
    @NamedQuery(name = "Empresa.findByQtdFunc", query = "SELECT e FROM Empresa e WHERE e.qtdFunc = :qtdFunc")})
public class Empresa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idempresa")
    private Integer idempresa;
    @Basic(optional = false)
    @Column(name = "razao_social")
    private String razaoSocial;
    @Column(name = "cnpj")
    private String cnpj;
    @Column(name = "ramo")
    private String ramo;
    @Column(name = "qtd_func")
    private Integer qtdFunc;
    @JoinColumn(name = "idtipo_treino", referencedColumnName = "idtipo_treino")
    @ManyToOne(optional = false)
    private TipoTreino idtipoTreino;
    @JoinColumn(name = "idtipo_contrato", referencedColumnName = "idtipo_contrato")
    @ManyToOne(optional = false)
    private TipoContrato idtipoContrato;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idempresa")
    private List<Contato> contatoList;

    public Empresa() {
    }

    public Empresa(Integer idempresa) {
        this.idempresa = idempresa;
    }

    public Empresa(Integer idempresa, String razaoSocial) {
        this.idempresa = idempresa;
        this.razaoSocial = razaoSocial;
    }

    public Integer getIdempresa() {
        return idempresa;
    }

    public void setIdempresa(Integer idempresa) {
        this.idempresa = idempresa;
    }

    public String getRazaoSocial() {
        return razaoSocial;
    }

    public void setRazaoSocial(String razaoSocial) {
        this.razaoSocial = razaoSocial;
    }

    public String getCnpj() {
        return cnpj;
    }

    public void setCnpj(String cnpj) {
        this.cnpj = cnpj;
    }

    public String getRamo() {
        return ramo;
    }

    public void setRamo(String ramo) {
        this.ramo = ramo;
    }

    public Integer getQtdFunc() {
        return qtdFunc;
    }

    public void setQtdFunc(Integer qtdFunc) {
        this.qtdFunc = qtdFunc;
    }

    public TipoTreino getIdtipoTreino() {
        return idtipoTreino;
    }

    public void setIdtipoTreino(TipoTreino idtipoTreino) {
        this.idtipoTreino = idtipoTreino;
    }

    public TipoContrato getIdtipoContrato() {
        return idtipoContrato;
    }

    public void setIdtipoContrato(TipoContrato idtipoContrato) {
        this.idtipoContrato = idtipoContrato;
    }

    @XmlTransient
    public List<Contato> getContatoList() {
        return contatoList;
    }

    public void setContatoList(List<Contato> contatoList) {
        this.contatoList = contatoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idempresa != null ? idempresa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empresa)) {
            return false;
        }
        Empresa other = (Empresa) object;
        if ((this.idempresa == null && other.idempresa != null) || (this.idempresa != null && !this.idempresa.equals(other.idempresa))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "teste.Empresa[ idempresa=" + idempresa + " ]";
    }
    
}
